This invention relates to editing a table in an electronic document. More particularly, this invention relates to using a table tool to add an integrated header to a table, to add a nested table to a table, and to merge cells within a table.
Use of word processing program modules has increased in recent years due in part to the flexibility and simplicity of these programs. Oftentimes, documents with tables are produced using these word processing program modules. Unfortunately, documents with tables are not as easy to produce as documents composed entirely of text. Thus, word processing program developers have tried to develop easier, simpler, and more user-friendly mechanisms for producing and editing tables in an electronic document to provide a more competitive word processing program.
In order to better understand how tables are produced and stored in an electronic document, it is helpful to review how elements of a document, in general, are produced and stored. Some word processing program modules store elements of an electronic document on a character basis. For these character-based word processing program modules, new table-forming characters may be added as characters to the word processing program module so that tables may be inserted into a document. For example, referring to FIG. 1, several different table-forming characters 10 are illustrated: a horizontal line 15, a vertical line 20, corner characters 25, 30, 35, 40, four-way junction 45, and t-junctions 50, 55. Using these table-forming characters 10, a user may construct a table of virtually any size and shape using either a keyboard or a mouse to add the table-forming characters to a document.
In early versions of program modules with table-forming characters, the addition of textual characters to a table might destroy the shape of the table since any added characters could push or move the table-forming characters and, thus, destroy the shape of the table. In later improvements, program modules were provided with some intelligence to determine whether the characters on a line constitute a table and, if so, to make certain adjustments. For example, the program may make an adjustment to switch to an over-type mode or to wrap text to the next line. Although table-forming characters provide an adequate solution for tables in word processing program modules that store elements on a character basis, some word processing program modules do not store elements of a document on a character basis. Thus, a different solution is needed to provide easy-to-use tables for these program modules.
Some word processing program modules store text as a stream of characters with paragraph marks. The paragraph marks hold formatting information for the stream of characters. Typically, in these stream-based program modules, cells in a table are composed of a series of paragraphs with special table formatting. The special table formatting may describe attributes of the cell such as the type of border of the cell, the row that the cell is in, the height of the row, whether text is displayed at the top, the middle, or the bottom of the cell, justification of text in the cell, and other attributes. Thus, although the table appears on screen as a single object, it may be stored as a series of paragraphs.
Some word processing program modules also include master cells and slave cells for tables. Typically, master cells control the formatting of slave cells. Slave cells are suppressed, i.e., their borders, contents, etc., are controlled by the master cell. Referring now to FIG. 2, a table 200 is illustrated including master cells and slave cells. In FIG. 2, the dashed lines represent lines that define cell borders, but which are not displayed on-screen. It should be understood that a row in a table typically must be the same height across the entire row. Thus, there is a need for master cells and slave cells. Cell 205 appears to the user as one large cell when it is actually composed of four cells: a master cell 210 and slave cells 215. It should also be understood that cell 217 is composed of master cell 220 and slave cells 225. Generally, all slaves cells must be calculated before the complete cells 205, 217 can be drawn because the complete cell boundaries are not known until all the slave cells have been calculated.
In some stream-based word processing program modules, a table drawing tool for drawing tables is available. Generally, a table drawing tool allows a user to insert a one-cell table by clicking down a mouse button at a point in a document. The user holds down the mouse button and drags the mouse to increase or decrease the size of the table. When the user releases the mouse button, the table is inserted into the document at the insertion point. Prior to the availability of a table drawing tool, a table was inserted into a document by selecting an insert table command from a menu.
Although using the prior art table drawing tools are more convenient than selecting an insert table command from a menu, there are problems with these prior art table drawing tools. For example, these prior art table drawing tools do not allow users to insert an integrated header into a table. An integrated header is a cell merged into the cell border of another cell. Referring now to FIG. 3A, an integrated header 300 is illustrated. The integrated header 300 is part of the table 305. The integrated header 300 may be used for any purpose, such as displaying a title 310 for the table 305. Using prior art methods, the integrated header 300 may be inserted using the table-forming characters 10 illustrated in FIG. 1. However, using these table-forming characters is time-consuming for the user. Moreover, if the integrated header 300 needs to be resized, then the table-forming characters will have to be manually adjusted accordingly by the user.
Another prior art method for forming the integrated header 300 is to manually merge and split cells in a table to form the integrated header 300. However, this process is time-consuming, difficult to master, and counterintuitive to a user""s expectations. For example, the user expects to be able to use a table drawing tool to add the integrated header. However, prior art table drawing tools do not provide the capability of adding an integrated header. Thus, there is a need for an intuitive method for using a table drawing tool to quickly add an integrated header.
Another problem of the prior art table drawing tools and methods is the problem of creating nested tables. Referring now to FIG. 3B, a nested table 315 is illustrated. A nested table is typically either entirely inside another cell, or entirely surrounds another cell. Thus, a nested table is typically one table xe2x80x9cnestedxe2x80x9d within a second table as illustrated, in FIG. 3B. The nested table 315 is nested within the table 320. Using prior art methods, the nested table 315 may be inserted into a document using the table-forming characters 10 illustrated in FIG. 1. However, using these table-forming characters is time-consuming for the user. Moreover, if the nested table 315 needs to be resized, then the table-forming characters will have to be manually adjusted accordingly by the user.
There are prior art methods for simulating the nested table 315 by merging and removing borders, but this is not so useful because text does not flow around the nested table, and the table itself does not move in the cell with other content. However, this process is time-consuming, difficult to master, and counterintuitive to a user""s expectations because the user expects to be able to use a table drawing tool to add the nested table. Thus, there is a need for an intuitive method for using a table drawing tool to quickly add a nested table.
Yet another problem of the prior art table drawing tools and methods is editing a table to merge cells or remove cell borders. Referring now to FIG. 4, a table 400 and table drawing tool 403 are illustrated. Typically, in the prior art, to remove a border, such as border 405, the table drawing tool must be moved along the border 405 until the border is highlighted to indicate that it will be removed, such as when a mouse button is released. The border 405 between cells 410 and 415 may then be removed. One problem associated with the prior art is that the table tool (eraser icon) 403 must be moved over a significant portion of border 405 before the border is highlighted for removal. This is time-consuming and counterintuitive to the user. A user typically expects to be able to erase a border by simply moving the table drawing tool across the border in a left to right or right to left motion. Thus, there is a need for an intuitive method for using a table drawing tool to remove borders.
In summary, there is a need in the art for a method and system for quickly and easily adding an integrated header to a table. There is a further need in the art for a method and system for quickly and easily adding a nested table to a table. There is still a further need for a method and system for quickly and easily removing borders from a table.
Generally described, the present invention provides a computer-implemented method for adding an integrated header row to a table, adding a nested table to a table, and merging cells in a table. A table drawing tool may be used to add an integrated header to a table or add a nested table to a table in an intuitive manner, rather than using the inefficient and non-intuitive prior art methods. A table erasing tool may be used to delete and merge cells in a table in an intuitive manner, rather than using the inefficient and non-intuitive prior art methods.
To add an integrated header row to a table, an indication is received to add an integrated header row. The table includes a first row and a first column, and the indication may include the dimensions of the integrated header row. A new row is added above the first row, which is then split forming the second and third rows in the table. In addition, the first column is split into a second column, a third column, and a fourth column. The table now includes a new first row, a second row, and a third row and a second column, a third column, and a fourth column. The borders of cells that are not part of the table or part of the integrated header row are suppressed so that they are not displayed to the user. The cells within the integrated header row are merged into a single cell. to add an integrated header column to a table in an electronic file, an indication is received to add an integrated header column, including the dimensions of the integrated header column. A second column is added aside the first column, which is then split into a third column and a fourth column. In addition, the first row is split into a second row, a third row, and a fourth row. The borders of cells that are not part of the table or part of the integrated header column are suppressed. The cells within the integrated header column are then merged, into a single cell.
In one aspect, the present invention is a computer-implemented method for determining whether to add an integrated header to the table based upon a drawn box entered by a user. The table includes horizontal cell borders and vertical cell borders. A determination is made whether the drawn box intersects at least one of the horizontal cell borders or vertical cell borders. If so, then a determination is made whether the drawn box is within a predetermined hit distance of at least one of the horizontal cell borders or at least one of the vertical cell borders. The predetermined hit distance is typically five pixels. If the drawn box is not within a predetermined hit distance of at least one of the horizontal cell borders or at least one of the vertical cell borders, then a determination is made whether the drawn box is greater than or equal to a predetermined minimum distance, and if so, then an integrated header is added to the table. The predetermined minimum distance is typically twenty pixels. In another aspect, the method may include determining whether to add an integrated header column or an integrated header row to the table before the step of adding the integrated header to the table. In still another aspect, the determination of whether to add an integrated header column or an integrated header row to the table includes determining to add an integrated header row if the drawn box intersects only one horizontal cell border and determining to add an integrated header column if the drawn box intersects only one vertical cell border.
In yet another aspect, the present invention is a method for adding a nested table to a table. The table may include a number of cells with vertical cell borders and horizontal cell borders. An indication of a drawn box is received. A determination is made whether the drawn box intersects at least one of the horizontal cell borders or at least one of the vertical cell borders. If not, then a determination is made whether the drawn box surrounds the table. If the drawn box surrounds the table, then the drawn box is added as a second table, and the table is converted to a nested table of the second table.
If the drawn box does not surround the table, then a determination is made whether the drawn box is surrounded by at least one cell of the table. If so, then the drawn box is added as a nested table of the cell that surrounds the drawn box.
In another aspect, the present invention is a computer-implemented method for merging cells in a table. The table may include at least one row and at least one column and a number of cells with vertical cell borders and horizontal cell borders. An indication is received to merge cells. Typically, the indication indicates that certain cell borders should be removed, or deleted. Cells are merged horizontally across each row that includes a cell border that has been indicated for removal and cells are merged vertically across each column that includes a cell border that has been indicated for removal. The merging is repeated until no further horizontal mergers and no further vertical mergers are successful.
In one aspect, the indication to merge cells is a drawn box and the cell borders indicated for deletion are cell borders that are intersected by the drawn box or completely contained within the drawn box. The drawn box may be entered using a table erasing tool.
In one aspect, to determine whether any cells of the table need to be merged, a determination is made whether an insertion point of the drawn box is outside of a predetermined hit area of the vertical cell borders and the horizontal cell borders. If so, then a determination is made whether the drawn box crosses at least one cell border. If so, then a determination is made that the cells including at least one cell border within the drawn box and the cells intersected by the drawn box need to be merged.
These and other features, advantages, and aspects of the present invention may be more clearly understood and appreciated from a review of the following detailed description of the disclosed embodiments and by reference to the appended drawings and claims.